//
//  UIButton+Extension.swift
//  weibo002
//
//  Created by mac on 10/19/15.
//  Copyright © 2015 mac. All rights reserved.
//

import UIKit

extension UIButton{
    convenience init(imageName:String, backgroundImageName:String){
        self.init()
        
        setImage(UIImage(named: imageName), forState: .Normal)
        setImage(UIImage(named: imageName + "_highlighted"), forState: .Highlighted)
        setBackgroundImage(UIImage(named: backgroundImageName), forState: .Normal)
        setBackgroundImage(UIImage(named: backgroundImageName + "_highlighted"), forState: .Highlighted)
        sizeToFit()
    }
    convenience init(title: String, color: UIColor, imageName:String){
        self.init()
        setTitle(title, forState: .Normal)
        setTitleColor(color, forState: .Normal)
        setBackgroundImage(UIImage(named: imageName), forState: .Normal)
        sizeToFit()
        
    }
}
